<div class="smart-rightPanel layui-form">
    <div class="layui-anim layui-anim-upbit">
        <blockquote class="site-text layui-elem-quote">
        </blockquote>
        <table id="list_table" class="layui-hide" lay-filter="mainList"></table>
    </div>
</div>
<script>
    layui.use(['layer', 'table', 'form','jquery'], function () {
        var layer = layui.layer;
        var table = layui.table;
        var form = layui.form;
        var  $ = layui.jquery;
        var tableObj = table.render({
            id: 'list_table'
            , elem: '#list_table'
            , url: 'buss/daka'
            , where: {id:getHashParam().id}
            , align: "center"
            , cols: [[ //表头
                 {field: 'id', title: '编号',align: 'center', templet: function (d) {
                         return '<a class="font-primary" href="views/index.html#/buss/dakaLog/list[dakaId='+d.id+']">'+d.issueNumber+'</a>'
                     }}
                , {field: 'createDate', title: '创建时间',  align: 'center'}
                , {field: 'closeTime', title: '关闭时间',  align: 'center'}
                , {field: 'zongNum', title: '参与人数',  align: 'center'}
                , {field: 'zong', title: '总金额',  align: 'center'}
                , {field: 'jiang', title: '奖池金额',  align: 'center'}
            ]]
        });

        $("#search").click(function () {
            reloadTable(tableObj);
        });



        //表格内部操作按钮监听
        table.on('tool(mainList)', function (obj) {
            var data = obj.data;
            var layEvent = obj.event;
            if (layEvent === 'edit') {
                showDialog({
                    title: '修改',
                    template: 'edit',
                    saveUrl: 'buss/task/save',
                    tableObj: tableObj,
                    htmlData: data,
                    width : 1000
                    ,beforeSubmit: function (data) {
                        if (data.taskStatus=='-1') {
                            layer.msg("请选择类型");
                            return false;
                        }
                        return true;
                    }
                })
            }else if(layEvent === 'excel'){
                window.location.href="buss/task/excel?taskId="+data.id;
            }else if(layEvent === 'daoru'){
                showDialog({
                    title: '比对录入',
                    template: 'daoru',
                    saveUrl: '/buss/task/log/out',
                    tableObj: tableObj,
                    htmlData: data,
                    width : 750
                })
            }
        });


    });
</script>

